package org.mc.api.newes;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.mc.common.data.PagedDTO;
import org.mc.common.data.ResultData;
import org.mc.request.es.ProjectRequest;
import org.mc.response.es.ProjectDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

@Api(value = "/ProjectServiceV1", tags = "ProjectServiceV1", description = "项目")
@FeignClient(value = "mc-new.es")
public interface ProjectServiceV1 {

    @RequestMapping(value = "/v1/i/pro/page", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询项目（分页）", notes = "查询项目（分页）", httpMethod = "GET", tags = "ProjectServiceV1")
    ResultData<PagedDTO<List<ProjectDTO>>> getPage(@ApiParam(value = "这是当前页数")
                                                   @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
                                                   @ApiParam(value = "这是每页条数")
                                                   @RequestParam(value = "pageSize", defaultValue = "2") int pageSize);

    @RequestMapping(value = "/v1/i/project", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加项目", notes = "添加项目", httpMethod = "POST", tags = "ProjectServiceV1")
    ResultData addProject(@RequestBody @Valid ProjectRequest projectRequest);

}